<?php

class Team extends Eloquent {
	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'team';

	/**
	 * Fetches all the matches that this team played in
	 *
	 * @return Match array
	 */
	public function matches()
    {
        return $this->belongsToMany('Match', 'match_teams', 'teamId', 'matchId');
    }
	
	/**
	 * Fetches all the users that play in this team
	 *
	 * @return User array
	 */
	public function users()
    {
        return $this->belongsToMany('User', 'team_users', 'teamId', 'userId');
    }
}
